package com.cskaoyan.simple.factory;

/**
 * @author stone
 * @date 2021/12/23 11:17
 */
public class Animal2Factory {

    public Animal2 create(String name) {
        if ("pig".equals(name)) {
            return new Pig();
        } else if ("sheep".equals(name)) {
            return new Sheep();
        } else if ("chicken".equals(name)) {
            return new Chicken();
        } //开闭原则
        return null;
    }
}
